package prepro;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class WikitionaryVerbs {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new FileReader((new File(
				"../data/Verbs"))));
		BufferedWriter bw = new BufferedWriter(new FileWriter(new File(
				"/local/joofeit/WikitionaryVerbs")));
		String line = "";
		while ((line = br.readLine()) != null) {
			System.out.println(line);
			if (line.trim().startsWith("*")) {
				bw.write(line.trim().split(" ")[1] + "\n");
			}
			if (line.trim().startsWith(",")) {
				String[] lineArray = line.trim().split(",");
				for (String s : lineArray) {
					s.replaceAll("\\s", "");
					if (s.length() > 0) {
						bw.write(s.trim() + "\n");
					}
				}
			}
		}
		bw.close();
		br.close();
	}
}
